Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #warn choking on apostrophe #1478

Merged
merged 4 commits into from
Oct 11, 2023
Merged

Conversation

amylizzle
Copy link
Contributor

#warn directives shouldn't try to process the tokens. Fixes #1439 and adds test

@amylizzle amylizzle changed the title fix #warn choking on apostraphe fix #warn choking on apostrophe Oct 4, 2023
@wixoaGit
Copy link
Member

Might be better to instead have the lexer read the rest of the line and save it as the warning/error token's value. Something like this in the lexer:

case "warning": {
    StringBuilder message = new StringBuilder();

    while (GetCurrent() is not '\0' and not '\n') {
        message.Append(GetCurrent());
        Advance();
    }

    token = CreateToken(TokenType.DM_Preproc_Warning, "#warn", message.ToString());
    break;
}

and use (string)token.Value! in HandleErrorOrWarningDirective()

@wixoaGit wixoaGit merged commit 7a9d011 into OpenDreamProject:master Oct 11, 2023
4 checks passed
@amylizzle amylizzle deleted the warnfix branch October 11, 2023 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

#warn chokes on apostrophe
2 participants